package com.beaven.model.net;

import com.beaven.model.model.api.RspModel;
import com.beaven.model.model.api.account.AccountRspModel;
import com.beaven.model.model.api.account.LoginModel;
import com.beaven.model.model.api.account.RegisterModel;
import com.beaven.model.model.api.account.UpdatePwdModel;
import com.beaven.model.model.api.group.GroupCreateModel;
import com.beaven.model.model.api.group.GroupMemberCreateModel;
import com.beaven.model.model.api.group.UpdateGroupModel;
import com.beaven.model.model.api.message.MsgCreateModel;
import com.beaven.model.model.api.user.CategoryModel;
import com.beaven.model.model.api.user.UserUpdateModel;
import com.beaven.model.model.card.CategoryCard;
import com.beaven.model.model.card.GroupCard;
import com.beaven.model.model.card.GroupMemberCard;
import com.beaven.model.model.card.MessageCard;
import com.beaven.model.model.card.UserCard;
import java.util.List;
import retrofit2.Call;
import retrofit2.http.Body;
import retrofit2.http.DELETE;
import retrofit2.http.GET;
import retrofit2.http.POST;
import retrofit2.http.PUT;
import retrofit2.http.Path;
import rx.Observable;

/**
 * author: Beaven
 * time: 2017/5/18 10:41
 */

public interface HTTPService {

  // 注册
  @POST("account/register") Observable<RspModel<AccountRspModel>> register(
      @Body RegisterModel registerModel);

  // 登录
  @POST("account/login") Observable<RspModel<AccountRspModel>> login(@Body LoginModel loginModel);

  // 退出登录
  @PUT("account/logout") Observable<RspModel<AccountRspModel>> logout();

  // 更新用户信息，现在只有昵称修改
  @PUT("user") Observable<RspModel<UserCard>> updateUser(@Body UserUpdateModel model);

  // 更新密码
  @PUT("user/update") Observable<RspModel<UserCard>> updatePwd(@Body UpdatePwdModel model);

  // 搜索用户
  @GET("user/search/{name}") Observable<RspModel<List<UserCard>>> searchUser(
      @Path("name") String name);

  // 获取用户
  @GET("user/user/{userId}") Call<RspModel<UserCard>> getUser(@Path("userId") String userId);

  // 获取好友列表
  @GET("user/contact") Observable<RspModel<List<UserCard>>> contract();

  // 添加好友
  @PUT("user/follow/{userId}/{categoryId}") Observable<RspModel<UserCard>> addUser(
      @Path("userId") String userId, @Path("categoryId") String categoryId);

  // 删除好友
  @PUT("user/delete/{userId}") Observable<RspModel<UserCard>> deleteUser(
      @Path("userId") String userId);

  // 创建分组
  @POST("category") Observable<RspModel<CategoryCard>> createCategory(
      @Body CategoryModel categoryModel);

  // 获取分组列表
  @GET("category") Observable<RspModel<List<CategoryCard>>> getCategories();

  // 发送消息
  @POST("msg") Observable<RspModel<MessageCard>> msgPush(@Body MsgCreateModel model);

  // 创建群组
  @POST("group") Observable<RspModel<GroupCard>> createGroup(@Body GroupCreateModel model);

  // 删除群组
  @DELETE("group/{groupId}") Observable<RspModel> deleteGroup(@Path("groupId") String groupId);

  // 修改群组
  @PUT("group") Observable<RspModel<GroupCard>> updateGroup(@Body UpdateGroupModel model);

  @GET("group") Observable<RspModel<List<GroupCard>>> getGroups();

  // 增加群成员
  @POST("group/member") Observable<RspModel<List<GroupMemberCard>>> addGroupMember(
      @Body List<GroupMemberCreateModel> models);

  // 删除群成员
  @PUT("group/member") Observable<RspModel<List<GroupMemberCard>>> deleteGroupMember(
      @Body List<GroupMemberCreateModel> models);

  // 获取群成员
  @GET("group/member/{groupId}") Observable<RspModel<List<GroupMemberCard>>> getGroupMember(
      @Path("groupId") String groupId);
}
